import creatEditor from "./editor.js"
import logo from "./logo192.png"
import "./global.css"

const editor = creatEditor()

document.body.appendChild(editor)

const img = new Image()
img.src = logo

document.body.appendChild(img)

let lastEditor = editor 
if (module.hot) {

    module.hot.accept("./editor", () => {
        // console.log('editor 更新了， 手动处理热替换逻辑')
        // console.log('editor', editor)
        const value = lastEditor.innerHTML
        document.body.removeChild(lastEditor)
        const newEditor = creatEditor()
        newEditor.innerHTML = value
        document.body.appendChild(newEditor)
        lastEditor = newEditor
    })
    
    module.hot.accept("./logo192.png", () => {
        img.src = logo
    })
}